<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //load是等页面内容全部加载完毕，包含页面dom元素，图片，flash，cass等等
        //DOMContentLoaded 是DOM加载完毕，不包含图片，flash， css等可以执行，加载速度比load快一些
        document.addEventListener('DOMContentLoaded', function() {
            console.log('dom加载完成时调用');
        })

        window.onload = function() {
            console.log('load方法调用');
        }
    </script>
</body>
</html>